package ca.magex.gps.persistance;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Calendar;

import ca.magex.database.DatabaseManagerFactory;
import ca.magex.gps.entity.impl.GarminTrack;

public class GpsPersistenceService {

	public void persist(GarminTrack track) throws SQLException {
		PreparedStatement psth = getConnection().prepareStatement("INSERT INTO tagger.gps_track (start) VALUES (?)");
		psth.setTimestamp(1, new Timestamp(Calendar.getInstance().getTimeInMillis()));
		psth.execute();
	}
	
	private Connection getConnection() {
		return DatabaseManagerFactory.getManager().getConnection();
	}
	
	public static void main(String[] args) throws SQLException {
		new GpsPersistenceService().persist(null);
	}
	
}
